<template>
  <div class="scv-container">
    <p>{{content.subject}}</p>
    <option-button
      v-for="(index,text) in content.options"
      :key="index"
      :index="index"
      :text="text"
      @pop="valued"
    />
  </div>
</template>

<script>
import optionButton from "./components/optionButton";
export default {
  props: {
    content: {
      type: Object,
      required: false,
      default: null
    }
  },
  components: {
    optionButton
  },
  computed: {
    letters() {
      return this.$store.state.config.letters;
    }
  },
  methods: {
    valued(value) {
      let valid = -1;
      if (value === this.content.key || this.letters[value] === this.content.key) {
        valid = 1;
      }
      this.$emit("valued", {
        value: value,
        valid: valid,
        right: this.content.key
      });
    }
  }
};
</script>

<style scoped>
.scv-container {
  display: grid;
  row-gap: 1em;
}
</style>